<?php echo $this->fetch('header.html'); ?>
<div id="rightTop">
    <p>内容列表</p>
    <ul class="subnav">
        <li><a class="btn1" href="index.php?app=abouts">管理</a></li>
        <li><?php if ($this->_var['acategory']['cate_id']): ?><a class="btn1" href="index.php?app=abouts&amp;act=add">新增</a><?php else: ?><span>新增</span><?php endif; ?></li>
    </ul>
</div>
<?php if ($_GET['act'] != 'edit_wap'): ?>
<div class="info">
<form method="post" enctype="multipart/form-data" id="acategory_form">
    <table class="infoTable">
        <tr>
            <th class="paddingT15">
                名称:</th>
            <td class="paddingT15 wordSpacing5">
                <input class="infoTableInput2" id="cate_name" type="text" name="cate_name" value="<?php echo htmlspecialchars($this->_var['acategory']['cate_name']); ?>" />
                <label class="field_notice">内容的名称</label></td>
        </tr>
        <tr>
            <th class="paddingT15">
                <label for="parent_id">所属:</label></th>
            <td class="paddingT15 wordSpacing5">
                <select id="parent_id" name="parent_id" class="select_css"><option value="0">请选择...</option><?php echo $this->html_options(array('options'=>$this->_var['parents'],'selected'=>$this->_var['acategory']['parent_id'])); ?></select>                </td>
        </tr>
        <tr>
          <th class="paddingT15">别称：</th>
          <td class="paddingT15 wordSpacing5"><input class="infoTableInput2" id="code" type="text" name="code" value="<?php echo htmlspecialchars($this->_var['acategory']['code']); ?>" /> <label class="field_notice">(注：必须输入字母)</label></td>
        </tr>
        <tr>
            <th class="paddingT15">内容:</th>
            <td class="paddingT15 wordSpacing5">
            <script type="text/javascript" charset="utf-8" src="/data/ueditor/ueditor.config.js"></script>
            <script type="text/javascript" charset="utf-8" src="/data/ueditor/ueditor.all.min.js"> </script>
            <script type="text/javascript" charset="utf-8" src="/data/ueditor/lang/zh-cn/zh-cn.js"></script>
            <textarea name="content" id="content" style="width:98%;height:500px;"><?php echo htmlspecialchars($this->_var['acategory']['content']); ?></textarea>
            <script type="text/javascript">var ue = UE.getEditor('content');</script>
            </td>
        </tr>  
        <tr>
            <th class="paddingT15">显示前台列表:</th>
            <td class="paddingT15 wordSpacing5">
             <label><input name="can_show" id="can_show" type="radio" value="0" <?php if ($this->_var['acategory']['can_show'] != '1'): ?>checked="checked"<?php endif; ?> /> 显示</label>
             <label><input name="can_show" id="can_show" type="radio" value="1" <?php if ($this->_var['acategory']['can_show'] == '1'): ?>checked="checked"<?php endif; ?>/> 不显示</label>
            </td>
        </tr>                         
        <tr>
            <th class="paddingT15">排序:</th>
            <td class="paddingT15 wordSpacing5">
                <input class="sort_order" id="sort_order" type="text" name="sort_order" value="<?php echo $this->_var['acategory']['sort_order']; ?>" />
                <label class="field_notice">更新排序</label>             </td>
        </tr>
      <tr>
        <th></th>
        <td class="ptb20">
            <input class="formbtn" type="submit" name="Submit" value="提交" />
            <input class="formbtn" type="reset" name="reset" value="重置" />
        </td>
    </tr>
    </table>
</form>
</div>
<script type="text/javascript">
$(function(){
    $('#acategory_form').validate({
        errorPlacement: function(error, element){
            $(element).next('.field_notice').hide();
            $(element).after(error);
        },
        success  : function(label){
            label.addClass('right').text('OK!');
        },
        onfocusout : false,
        onkeyup    : false,
        rules : {
            cate_name : {
                required : true,
                remote   : {
                url :'index.php?app=abouts&act=check_acategory',
                type:'get',
                data:{
                    cate_name : function(){return $('#cate_name').val();},
                    parent_id : function(){return $('#parent_id').val();},
                    id : '<?php echo $this->_var['acategory']['cate_id']; ?>'
                  }
                }
            },
            sort_order : {number : true}
        },
        messages : {
            cate_name : { required : '内容名称不能为空', remote : '该分类名称已经存在了，请您换一个' },
            sort_order : { number : '排序仅能为数字' }
        }
    });
});
</script>

<?php elseif ($_GET['act'] == 'edit_wap'): ?>

<div class="info">
<form method="post" enctype="multipart/form-data" id="acategory_form">
    <table class="infoTable">
        <tr>
            <th class="paddingT15">名称:</th>
            <td class="paddingT15 wordSpacing5" height="30"><?php echo htmlspecialchars($this->_var['acategory']['cate_name']); ?><input type="hidden" name="cate_name" value="<?php echo htmlspecialchars($this->_var['acategory']['cate_name']); ?>" /></td>
        </tr>
        <tr>
            <th class="paddingT15">内容:</th>
            <td class="paddingT15 wordSpacing5">
            <script type="text/javascript" charset="utf-8" src="/data/ueditor/ueditor.config.js"></script>
            <script type="text/javascript" charset="utf-8" src="/data/ueditor/ueditor.all.min.js"> </script>
            <script type="text/javascript" charset="utf-8" src="/data/ueditor/lang/zh-cn/zh-cn.js"></script>
            <textarea name="content_wap" id="content_wap" style="width:98%;height:500px;"><?php echo htmlspecialchars($this->_var['acategory']['content_wap']); ?></textarea>
            <script type="text/javascript">var ue = UE.getEditor('content_wap');</script>
            </td>
        </tr>  
      <tr>
        <th></th>
        <td class="ptb20">
            <input class="formbtn" type="submit" name="Submit" value="提交" />
            <input class="formbtn" type="reset" name="reset" value="返回" onclick="javascript:history.go(-1)"/>
        </td>
    </tr>
    </table>
</form>
</div>

<?php endif; ?>
<?php echo $this->fetch('footer.html'); ?>